package com.demo.finalClass;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CarLocationTracker {

	private final Map<String, Location> locationMap = new ConcurrentHashMap<>();

	public void updateCarLocation(String code, Location newLocation) {
		locationMap.put(code, newLocation);
	}

	public Location getLocation(String code) {
		return locationMap.get(code);
	}

	private final List<Integer> data = new ArrayList<>();

	public CarLocationTracker () {
		data.add(1);
		data.add(2);
		data.add(3);
	}

	public List<Integer> getData () {
		return Collections.unmodifiableList(new ArrayList<>(data));
	}

	public static void main(String[] args) {
		CarLocationTracker tracker = new CarLocationTracker();
		List<Integer> data = tracker.getData();
		data.forEach(System.out::println);
	}
}
